//
//  VideoDataViewController.m
//  GameBoss
//
//  Created by dllo on 15/4/21.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "VideoDataViewController.h"

@interface VideoDataViewController ()

@property (nonatomic, retain)UIWebView *webView;
@end

@implementation VideoDataViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    NSURL *videoUrl = [NSURL URLWithString:self.itemUrl];
    NSURLRequest *request = [NSURLRequest requestWithURL:videoUrl];
    self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, Screen.width, Screen.height)];

    //伸缩内容适应屏幕尺寸
    self.webView.scalesPageToFit = NO;
    //加载网络请求
    [self.webView loadRequest:request];
    [self.view addSubview:self.webView];
    
    self.activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 32.0f, 32.0f)];
    self.activityIndicator.center = self.view.center;
    self.activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
    [self.view addSubview:self.activityIndicator];
    
    [self.activityIndicator startAnimating];

#pragma mark 乱码
//    1. 用 loadRequest 先获取网页，但先设置 UIWebView.hidden = YES;
//    2. 在 webViewDidFinishLoad 中，用
//    NSString *js_result2 = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementByIdx_x_x_xx_x_x('xxxx').innerHTML; "]
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
